import Vue from 'vue'
import router from './router'
import store from './store'
import 'webkit-normalize.css'
import 'animate.css'
import './styles/global.scss'
import axios from 'axios'
import VueAxios from 'vue-axios'
import qs from 'qs'
Vue.use(VueAxios, axios)

const FastClick = require('fastclick')
if (process.env.NODE_ENV === 'production') {
  FastClick.attach(document.body)
}

Vue.config.productionTip = false

axios.interceptors.request.use(config => {
  if (config.method === 'post') {
    config.data = qs.stringify(config.data)
    config.headers['Content-Type'] = 'application/x-www-form-urlencoded'
  }
  return config
})

const app = new Vue({
  name: 'App',
  router,
  store,
  template: `<router-view/>`
})

app.$mount('#app')
